package spring.security.util;

import java.util.concurrent.atomic.AtomicLong;

import org.apache.commons.lang.RandomStringUtils;

public class IDGenerator {
	private IDGenerator() {
	}

	private static final AtomicLong nextNum = new AtomicLong(1);

	public static long getNextNum() {
		return nextNum.getAndIncrement();
	}

	public static String getDefaultUUID() {

		String longNum = getNextNum() % 10000 + 10000 + "";
		String suffix = longNum.substring(longNum.length() - 4);
		return new StringBuffer().append(suffix).append(RandomStringUtils.randomNumeric(2)).toString();
	}
}
